﻿using Lanbt.Core.Entity.EntityDB;
using Lanbt.Core.Repository.SqlService.IRepository;
using SqlSugar;

namespace Lanbt.Core.Repository.SqlService
{
    public class PowerRepository : RepositoryBase<lanbt_power>, IPowerRepository
    {
        public PowerRepository(ISqlSugarClient db) : base(db)
        {
        }

        public Task<IList<lanbt_power>> QueryAllByEnable()
        {
            return Query(q => q.IsEnable);
        }

        public Task<IList<lanbt_power>> QueryMenuByShow()
        {
            return Query(q => q.IsMenuShow && q.IsEnable && (q.PowerType == Entity.Enums.PowerType.Folder || q.PowerType == Entity.Enums.PowerType.Html));
        }
    }
}
